<?php
/**
 *
 * @author Strawberry🍓
 * @date 2021-05-24 4:51 下午
 *
 */

namespace app\common\model\tang;


use app\common\impl\Comm;
use app\common\model\CommonBaseModel;

class ReleaseRecord extends CommonBaseModel implements Comm
{
    public function getAdminPageData($param = [], $order = 'id desc')
    {
        // TODO: Implement getAdminPageData() method.
        $where=[];
        isset($param['user_mobile']) && !empty($param['user_mobile'])?$where['user_mobile'] = $param['user_mobile']:false;
        $data = self::where($where)->with(['releases'])->order($order)->page(PAGE)->limit(LIMIT)->select()->toArray();
        $count = self::where($where)->count("id");
        return parent::ajaxResult($data, $count);
    }

    public function delById($id)
    {
        // TODO: Implement delById() method.
    }

    public function doAll($data)
    {
        // TODO: Implement doAll() method.
        return parent::doAllData($data);
    }

    public function releases()
    {
        return $this->hasOne(ReleaseUser::class,'id','release_user_id')->field('id,name');
    }
}